<template>
  <ul class="todo-main" :class="{ul_height:hasH}">
    <Item v-for="(todo,index) in todos" :key="todo.id" :todo="todo" :checkTodo="checkTodo"
    :deleteTodo="deleteTodo" :index="index"/>
  </ul>
  
</template>

<script>
import Item from './Itme.vue';
export default {
  name: 'List',
  //组件的注册
  components:{
      Item,
  },
  data(){
    return{
      hasH:false,
    }
  },
  watch: {
    todos(value){
      console.log(value);
      if(!value.length){
        this.hasH = true;
      }else{
        this.hasH = false;
      }
    }
  },
  // 声明接收属性
  props:{
    todos:Array,
    checkTodo:Function,
    deleteTodo:Function,
  }
}
</script>

<style scoped>
  .ul_height{
    height:352px;
    background:url('https://img2.baidu.com/it/u=3140155640,3646958200&fm=26&fmt=auto&gp=0.jpg') top center no-repeat ;
    background-size:cover;
  }
  .todo-main {
    margin-left: 0px;
    border: 1px solid #ddd;
    border-radius: 2px;
    padding: 0px;
  }

  .todo-empty {
    height: 40px;
    line-height: 40px;
    border: 1px solid #ddd;
    border-radius: 2px;
    padding-left: 5px;
    margin-top: 10px;
  }
</style>
